/*
 * Copyright 2007-2009 Perttu "celeron55" Ahola <celeron55@gmail.com>
 *
 * This file is part of jukumagic.
 *
 * jukumagic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * jukumagic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with jukumagic.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef COMPONENTTABLE_H_
#define COMPONENTTABLE_H_

#include "common.h"
#include "board.h"
#include "component.h"
#include <wx/grid.h>

class ComponentTable : public wxGridTableBase
{
	Board *m_board;
	std::vector<Component*> m_components;
public:
	ComponentTable();
	ComponentTable(Board *board);
	~ComponentTable();

	// This is called every time the board changes
	void SetBoard(Board *board);

	int GetNumberRows();
	int GetNumberCols();
	wxString GetValue(int row, int col);
	void SetValue(int row, int col, const wxString &s);
	bool IsEmptyCell(int row, int col);
	wxString GetColLabelValue(int col);

	Component* GetComponent(int row);
};

#endif
